<?php
$dbh=new PDO('mysql:host=localhost;dbname=gaofei','root','root');
$memcache=memcache_connect('127.0.0.1',11211);
$arr=$memcache->get('a');
if($arr='')
{
    echo "没有缓存";
    $sql="select * from gg";
    $arr=$dbh->query($sql)->fetchAll(PDO::FETCH_ASSOC);
    $memcache->set('a',$arr);
}
?>
<table border="1">
<tr>
    <td>地址</td>
    <td>图片地址</td>
    <td>标题</td>
    <td>简介</td>
</tr>
<?php foreach($arr as $key=>$value) { ?>
    <tr>
        <td><?php echo $value['id']?></td>
        <td><?php echo $value['url']?></td>
        <td><?php echo $value['img']?></td>
        <td><?php echo $value['title']?></td>
        <td><?php echo $value['text']?></td>
    </tr>
<?php } ?>
</table>